package org.jenkon.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class ControllerAspect {

	@Around("execution(* org.jenkon.controller..*Controller..*(..))")
	public Object around(final ProceedingJoinPoint proceedingJoinPoint) throws Throwable {

		System.out.println(proceedingJoinPoint.getSignature());

		final long start = System.currentTimeMillis();

		final Object obj = proceedingJoinPoint.proceed(proceedingJoinPoint.getArgs());

		System.out.println("Anzahl Sekunden: " + (System.currentTimeMillis() - start));

		return obj;

	}

}
